home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection 1998 Fall: Game Toolkit / Disc.iso / SDKs / Apple Game Sprockets / InputSprocket / Headers and Libraries / InputSprocket.h next >
Encoding:
C/C++ Source or Header  |  1998-07-17  |  28.1 KB  |  997 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        InputSprocket.h
  3.  
  4.      Contains:    General purpose interfaces for InputSprocket.
  5.                 Requires the software link with InputSprocketLib
  6.  
  7.      Version:    Technology:    InputSprocket 1.3
  8.                  Release:    InputSprocket 1.3
  9.  
  10.      Copyright:    © 1986-1998, 1995-1997 by Apple Computer, Inc., all rights reserved
  11.  
  12.      Bugs?:        Please include the the file and version information (from above) with
  13.                  the problem description.  Developers belonging to one of the Apple
  14.                  developer programs can submit bug reports to:
  15.  
  16.                      devsupport@apple.com
  17.  
  18. */
  19.  
  20. #ifndef __INPUTSPROCKET__
  21. #define __INPUTSPROCKET__
  22.  
  23. #ifndef __MACTYPES__
  24. #include <MacTypes.h>
  25. #endif
  26. #ifndef __EVENTS__
  27. #include <Events.h>
  28. #endif
  29.  
  30.  
  31.  
  32. #if PRAGMA_ONCE
  33. #pragma once
  34. #endif
  35.  
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39.  
  40. #if PRAGMA_IMPORT
  41. #pragma import on
  42. #endif
  43.  
  44. #if PRAGMA_STRUCT_ALIGN
  45.     #pragma options align=power
  46. #elif PRAGMA_STRUCT_PACKPUSH
  47.     #pragma pack(push, 2)
  48. #elif PRAGMA_STRUCT_PACK
  49.     #pragma pack(2)
  50. #endif
  51.  
  52. #ifndef USE_OLD_INPUT_SPROCKET_LABELS
  53. #define USE_OLD_INPUT_SPROCKET_LABELS 0
  54. #endif  /* !defined(USE_OLD_INPUT_SPROCKET_LABELS) */
  55.  
  56. #ifndef USE_OLD_ISPNEED_STRUCT
  57. #define USE_OLD_ISPNEED_STRUCT 0
  58. #endif  /* !defined(USE_OLD_ISPNEED_STRUCT) */
  59.  
  60. #if TARGET_RT_MAC_CFM
  61. /* ********************* data types ********************* */
  62. typedef struct OpaqueISpDeviceReference*  ISpDeviceReference;
  63. typedef struct OpaqueISpElementReference*  ISpElementReference;
  64. typedef struct OpaqueISpElementListReference*  ISpElementListReference;
  65. /* ISpDeviceClass is a general classs of device, example: keyboard, mouse, joystick */
  66. typedef OSType                             ISpDeviceClass;
  67. /* ISpDeviceIdentifier is a specific device,  example: standard 1-button mouse, 105key ext. kbd. */
  68. typedef OSType                             ISpDeviceIdentifier;
  69. typedef OSType                             ISpElementLabel;
  70. typedef OSType                             ISpElementKind;
  71.  
  72. /* *************** errors -30420 to -30439***************** */
  73.  
  74. enum {
  75.     kISpInternalErr                = -30420,
  76.     kISpSystemListErr            = -30421,
  77.     kISpBufferToSmallErr        = -30422,
  78.     kISpElementInListErr        = -30423,
  79.     kISpElementNotInListErr        = -30424,
  80.     kISpSystemInactiveErr        = -30425,
  81.     kISpDeviceInactiveErr        = -30426,
  82.     kISpSystemActiveErr            = -30427,
  83.     kISpDeviceActiveErr            = -30428,
  84.     kISpListBusyErr                = -30429
  85. };
  86.  
  87. /* *************** resources **************** */
  88.  
  89. enum {
  90.     kISpApplicationResourceType    = FOUR_CHAR_CODE('isap'),
  91.     kISpSetListResourceType        = FOUR_CHAR_CODE('setl'),
  92.     kISpSetDataResourceType        = FOUR_CHAR_CODE('setd')
  93. };
  94.  
  95.  
  96. struct ISpApplicationResourceStruct {
  97.     UInt32                             flags;
  98.     UInt32                             reserved1;
  99.     UInt32                             reserved2;
  100.     UInt32                             reserved3;
  101. };
  102. typedef struct ISpApplicationResourceStruct ISpApplicationResourceStruct;
  103.  
  104. enum {
  105.     kISpAppResFlag_UsesInputSprocket = 0x00000001,                /* true if the application uses InputSprocket*/
  106.     kISpAppResFlag_UsesISpInit    = 0x00000002                    /* true if the calls ISpInit (ie, uses the high level interface, calls ISpConfigure, has a needs list, etc...)*/
  107. };
  108.  
  109. /*
  110.  * ISpDeviceDefinition
  111.  *
  112.  * This structure provides all the available
  113.  * information for an input device within the system
  114.  *
  115.  */
  116.  
  117. struct ISpDeviceDefinition {
  118.     Str63                             deviceName;                    /* a human readable name of the device */
  119.     ISpDeviceClass                     theDeviceClass;                /* general classs of device example : keyboard, mouse, joystick */
  120.     ISpDeviceIdentifier             theDeviceIdentifier;        /* every distinguishable device should have an OSType */
  121.     UInt32                             permanentID;                /* a cross reboot id unique within that deviceType, 0 if not possible */
  122.     UInt32                             flags;                        /* status flags */
  123.     UInt32                             reserved1;
  124.     UInt32                             reserved2;
  125.     UInt32                             reserved3;
  126. };
  127. typedef struct ISpDeviceDefinition        ISpDeviceDefinition;
  128.  
  129. enum {
  130.     kISpDeviceFlag_HandleOwnEmulation = 1
  131. };
  132.  
  133. /*
  134.  * ISpElementEvent, ISpElementEventPtr
  135.  *
  136.  * This is the structure that event data is passed in.
  137.  *
  138.  */
  139.  
  140. struct ISpElementEvent {
  141.     AbsoluteTime                     when;                        /* this is absolute time on PCI or later, otherwise it is */
  142.                                                                 /* 0 for the hi 32 bits and TickCount for the low 32 bits */
  143.     ISpElementReference             element;                    /* a reference to the element that generated this event */
  144.     UInt32                             refCon;                        /* for application usage, 0 on the global list */
  145.     UInt32                             data;                        /* the data for this event */
  146. };
  147. typedef struct ISpElementEvent            ISpElementEvent;
  148. typedef ISpElementEvent *                ISpElementEventPtr;
  149. /*
  150.  * ISpElementInfo, ISpElementInfoPtr
  151.  *
  152.  * This is the generic definition of an element.
  153.  * Every element must contain this information.
  154.  *
  155.  */
  156.  
  157. struct ISpElementInfo {
  158.     ISpElementLabel                 theLabel;
  159.     ISpElementKind                     theKind;
  160.     Str63                             theString;
  161.     UInt32                             reserved1;
  162.     UInt32                             reserved2;
  163. };
  164. typedef struct ISpElementInfo            ISpElementInfo;
  165. typedef ISpElementInfo *                ISpElementInfoPtr;
  166.  
  167. typedef UInt32                             ISpNeedFlagBits;
  168. #if USE_OLD_ISPNEED_STRUCT
  169.  
  170. struct ISpNeed {
  171.     Str63                             name;
  172.     short                             iconSuiteResourceId;        /* resource id of the icon suite */
  173.     short                             reserved;
  174.     ISpElementKind                     theKind;
  175.     ISpElementLabel                 theLabel;
  176.     ISpNeedFlagBits                 flags;
  177.     UInt32                             reserved1;
  178.     UInt32                             reserved2;
  179.     UInt32                             reserved3;
  180. };
  181. typedef struct ISpNeed                    ISpNeed;
  182. #else
  183.  
  184. struct ISpNeed {
  185.     Str63                             name;                        /* human-readable string */
  186.     short                             iconSuiteResourceId;        /* resource id of the icon suite */
  187.     UInt8                             playerNum;                    /* used for multi-player support */
  188.     UInt8                             group;                        /* used to group related needs (eg, look left and look right button needs) */
  189.     ISpElementKind                     theKind;
  190.     ISpElementLabel                 theLabel;
  191.     ISpNeedFlagBits                 flags;
  192.     UInt32                             reserved1;
  193.     UInt32                             reserved2;
  194.     UInt32                             reserved3;
  195. };
  196. typedef struct ISpNeed                    ISpNeed;
  197. #endif  /* USE_OLD_ISPNEED_STRUCT */
  198.  
  199.  
  200. enum {
  201.     kISpNeedFlag_NoMultiConfig    = 0x00000001,                    /* once this need is autoconfigured to one device dont autoconfigure to anything else*/
  202.     kISpNeedFlag_Utility        = 0x00000002,                    /* this need is a utility function (like show framerate) which would not typically be assigned to anything but the keyboard*/
  203.     kISpNeedFlag_PolledOnly        = 0x00000004,
  204.     kISpNeedFlag_EventsOnly        = 0x00000008,                    /* *** kISpElementKind specific flags ****/
  205.                                                                 /* these are flags specific to kISpElementKind_Button*/
  206.     kISpNeedFlag_Button_AlreadyAxis = 0x10000000,                /* there is a axis version of this button need*/
  207.     kISpNeedFlag_Button_ClickToggles = 0x20000000,
  208.     kISpNeedFlag_Button_ActiveWhenDown = 0x40000000,
  209.     kISpNeedFlag_Button_AlreadyDelta = (long)0x80000000,        /* there is a delta version of this button need*/
  210.                                                                 /* these are flags specific to kISpElementKind_DPad*/
  211.                                                                 /* these are flags specific to kISpElementKind_Axis*/
  212.     kISpNeedFlag_Axis_AlreadyButton = 0x10000000,                /* there is a button version of this axis need*/
  213.     kISpNeedFlag_Axis_Asymetric    = 0x20000000,                    /* this axis need is asymetric    */
  214.     kISpNeedFlag_Axis_AlreadyDelta = 0x40000000,                /* there is a delta version of this axis need*/
  215.                                                                 /* these are flags specific to kISpElementKind_Delta*/
  216.     kISpNeedFlag_Delta_AlreadyAxis = 0x10000000,                /* there is a axis version of this delta need*/
  217.     kISpNeedFlag_Delta_AlreadyButton = 0x20000000                /* there is a button version of this delta need*/
  218. };
  219.  
  220. /*
  221.  *
  222.  * These are the current built values for ISpDeviceClass
  223.  *
  224.  */
  225.  
  226. enum {
  227.     kISpDeviceClass_SpeechRecognition = FOUR_CHAR_CODE('talk'),
  228.     kISpDeviceClass_Mouse        = FOUR_CHAR_CODE('mous'),
  229.     kISpDeviceClass_Keyboard    = FOUR_CHAR_CODE('keyd'),
  230.     kISpDeviceClass_Joystick    = FOUR_CHAR_CODE('joys'),
  231.     kISpDeviceClass_Wheel        = FOUR_CHAR_CODE('whel'),
  232.     kISpDeviceClass_Pedals        = FOUR_CHAR_CODE('pedl'),
  233.     kISpDeviceClass_Levers        = FOUR_CHAR_CODE('levr'),
  234.     kISpDeviceClass_Tickle        = FOUR_CHAR_CODE('tckl'),        /* a device of this class requires ISpTickle*/
  235.     kISpDeviceClass_Unknown        = FOUR_CHAR_CODE('????')
  236. };
  237.  
  238. /*
  239.  * These are the current built in ISpElementKind's
  240.  * 
  241.  * These are all OSTypes.
  242.  *
  243.  */
  244.  
  245. enum {
  246.     kISpElementKind_Button        = FOUR_CHAR_CODE('butn'),
  247.     kISpElementKind_DPad        = FOUR_CHAR_CODE('dpad'),
  248.     kISpElementKind_Axis        = FOUR_CHAR_CODE('axis'),
  249.     kISpElementKind_Delta        = FOUR_CHAR_CODE('dlta'),
  250.     kISpElementKind_Movement    = FOUR_CHAR_CODE('move'),
  251.     kISpElementKind_Virtual        = FOUR_CHAR_CODE('virt')
  252. };
  253.  
  254.  
  255. /*
  256.  *
  257.  * These are the current built in ISpElementLabel's
  258.  *
  259.  * These are all OSTypes.
  260.  *
  261.  */
  262. #if USE_OLD_INPUT_SPROCKET_LABELS
  263.  
  264. enum {
  265.                                                                 /* axis */
  266.     kISpElementLabel_XAxis        = FOUR_CHAR_CODE('xaxi'),
  267.     kISpElementLabel_YAxis        = FOUR_CHAR_CODE('yaxi'),
  268.     kISpElementLabel_ZAxis        = FOUR_CHAR_CODE('zaxi'),
  269.     kISpElementLabel_Rx            = FOUR_CHAR_CODE('rxax'),
  270.     kISpElementLabel_Ry            = FOUR_CHAR_CODE('ryax'),
  271.     kISpElementLabel_Rz            = FOUR_CHAR_CODE('rzax'),
  272.     kISpElementLabel_Gas        = FOUR_CHAR_CODE('gasp'),
  273.     kISpElementLabel_Brake        = FOUR_CHAR_CODE('brak'),
  274.     kISpElementLabel_Clutch        = FOUR_CHAR_CODE('cltc'),
  275.     kISpElementLabel_Throttle    = FOUR_CHAR_CODE('thrt'),
  276.     kISpElementLabel_Trim        = FOUR_CHAR_CODE('trim'),        /* direction pad */
  277.     kISpElementLabel_POVHat        = FOUR_CHAR_CODE('povh'),
  278.     kISpElementLabel_PadMove    = FOUR_CHAR_CODE('move'),        /* buttons */
  279.     kISpElementLabel_Fire        = FOUR_CHAR_CODE('fire'),
  280.     kISpElementLabel_Start        = FOUR_CHAR_CODE('strt'),
  281.     kISpElementLabel_Select        = FOUR_CHAR_CODE('optn')
  282. };
  283.  
  284. #endif  /* USE_OLD_INPUT_SPROCKET_LABELS */
  285.  
  286.  
  287. enum {
  288.                                                                 /* generic */
  289.     kISpElementLabel_None        = FOUR_CHAR_CODE('none'),        /* axis */
  290.     kISpElementLabel_Axis_XAxis    = FOUR_CHAR_CODE('xaxi'),
  291.     kISpElementLabel_Axis_YAxis    = FOUR_CHAR_CODE('yaxi'),
  292.     kISpElementLabel_Axis_ZAxis    = FOUR_CHAR_CODE('zaxi'),
  293.     kISpElementLabel_Axis_Rx    = FOUR_CHAR_CODE('rxax'),
  294.     kISpElementLabel_Axis_Ry    = FOUR_CHAR_CODE('ryax'),
  295.     kISpElementLabel_Axis_Rz    = FOUR_CHAR_CODE('rzax'),
  296.     kISpElementLabel_Axis_Roll    = kISpElementLabel_Axis_Rz,
  297.     kISpElementLabel_Axis_Pitch    = kISpElementLabel_Axis_Rx,
  298.     kISpElementLabel_Axis_Yaw    = kISpElementLabel_Axis_Ry,
  299.     kISpElementLabel_Axis_RollTrim = FOUR_CHAR_CODE('rxtm'),
  300.     kISpElementLabel_Axis_PitchTrim = FOUR_CHAR_CODE('trim'),
  301.     kISpElementLabel_Axis_YawTrim = FOUR_CHAR_CODE('rytm'),
  302.     kISpElementLabel_Axis_Gas    = FOUR_CHAR_CODE('gasp'),
  303.     kISpElementLabel_Axis_Brake    = FOUR_CHAR_CODE('brak'),
  304.     kISpElementLabel_Axis_Clutch = FOUR_CHAR_CODE('cltc'),
  305.     kISpElementLabel_Axis_Throttle = FOUR_CHAR_CODE('thrt'),
  306.     kISpElementLabel_Axis_Trim    = kISpElementLabel_Axis_PitchTrim,
  307.     kISpElementLabel_Axis_Rudder = FOUR_CHAR_CODE('rudd'),        /* delta */
  308.     kISpElementLabel_Delta_X    = FOUR_CHAR_CODE('xdlt'),
  309.     kISpElementLabel_Delta_Y    = FOUR_CHAR_CODE('ydlt'),
  310.     kISpElementLabel_Delta_Z    = FOUR_CHAR_CODE('zdlt'),
  311.     kISpElementLabel_Delta_Rx    = FOUR_CHAR_CODE('rxdl'),
  312.     kISpElementLabel_Delta_Ry    = FOUR_CHAR_CODE('rydl'),
  313.     kISpElementLabel_Delta_Rz    = FOUR_CHAR_CODE('rzdl'),
  314.     kISpElementLabel_Delta_Roll    = kISpElementLabel_Delta_Rz,
  315.     kISpElementLabel_Delta_Pitch = kISpElementLabel_Delta_Rx,
  316.     kISpElementLabel_Delta_Yaw    = kISpElementLabel_Delta_Ry,    /* direction pad */
  317.     kISpElementLabel_Pad_POV    = FOUR_CHAR_CODE('povh'),        /* up/down/left/right*/
  318.     kISpElementLabel_Pad_Move    = FOUR_CHAR_CODE('move'),        /* up/down/left/right*/
  319.     kISpElementLabel_Pad_POV_Horiz = FOUR_CHAR_CODE('hpov'),    /* forward/back/left/right*/
  320.     kISpElementLabel_Pad_Move_Horiz = FOUR_CHAR_CODE('hmov'),    /* forward/back/left/right*/
  321.                                                                 /* buttons */
  322.     kISpElementLabel_Btn_Fire    = FOUR_CHAR_CODE('fire'),
  323.     kISpElementLabel_Btn_SecondaryFire = FOUR_CHAR_CODE('sfir'),
  324.     kISpElementLabel_Btn_Jump    = FOUR_CHAR_CODE('jump'),
  325.     kISpElementLabel_Btn_PauseResume = FOUR_CHAR_CODE('strt'),    /* kISpElementLabel_Btn_PauseResume automatically binds to escape */
  326.     kISpElementLabel_Btn_Select    = FOUR_CHAR_CODE('optn'),
  327.     kISpElementLabel_Btn_SlideLeft = FOUR_CHAR_CODE('blft'),
  328.     kISpElementLabel_Btn_SlideRight = FOUR_CHAR_CODE('brgt'),
  329.     kISpElementLabel_Btn_MoveForward = FOUR_CHAR_CODE('btmf'),
  330.     kISpElementLabel_Btn_MoveBackward = FOUR_CHAR_CODE('btmb'),
  331.     kISpElementLabel_Btn_TurnLeft = FOUR_CHAR_CODE('bttl'),
  332.     kISpElementLabel_Btn_TurnRight = FOUR_CHAR_CODE('bttr'),
  333.     kISpElementLabel_Btn_LookLeft = FOUR_CHAR_CODE('btll'),
  334.     kISpElementLabel_Btn_LookRight = FOUR_CHAR_CODE('btlr'),
  335.     kISpElementLabel_Btn_LookUp    = FOUR_CHAR_CODE('btlu'),
  336.     kISpElementLabel_Btn_LookDown = FOUR_CHAR_CODE('btld'),
  337.     kISpElementLabel_Btn_Next    = FOUR_CHAR_CODE('btnx'),
  338.     kISpElementLabel_Btn_Previous = FOUR_CHAR_CODE('btpv'),
  339.     kISpElementLabel_Btn_SideStep = FOUR_CHAR_CODE('side'),
  340.     kISpElementLabel_Btn_Run    = FOUR_CHAR_CODE('quik'),
  341.     kISpElementLabel_Btn_Look    = FOUR_CHAR_CODE('blok')
  342. };
  343.  
  344. /*
  345.  *
  346.  * direction pad data & configuration information
  347.  *
  348.  */
  349.  
  350. typedef UInt32                             ISpDPadData;
  351.  
  352. enum {
  353.     kISpPadIdle                    = 0,
  354.     kISpPadLeft                    = 1,
  355.     kISpPadUpLeft                = 2,
  356.     kISpPadUp                    = 3,
  357.     kISpPadUpRight                = 4,
  358.     kISpPadRight                = 5,
  359.     kISpPadDownRight            = 6,
  360.     kISpPadDown                    = 7,
  361.     kISpPadDownLeft                = 8
  362. };
  363.  
  364.  
  365. struct ISpDPadConfigurationInfo {
  366.     UInt32                             id;                            /* ordering 1..n, 0 = no relavent ordering of direction pads */
  367.     Boolean                         fourWayPad;                    /* true if this pad can only produce idle + four directions */
  368. };
  369. typedef struct ISpDPadConfigurationInfo    ISpDPadConfigurationInfo;
  370. /*
  371.  *
  372.  * button data & configuration information
  373.  *
  374.  */
  375.  
  376. typedef UInt32                             ISpButtonData;
  377.  
  378. enum {
  379.     kISpButtonUp                = 0,
  380.     kISpButtonDown                = 1
  381. };
  382.  
  383.  
  384. struct ISpButtonConfigurationInfo {
  385.     UInt32                             id;                            /* ordering 1..n, 0 = no relavent ordering of buttons */
  386. };
  387. typedef struct ISpButtonConfigurationInfo ISpButtonConfigurationInfo;
  388. /*
  389.  *
  390.  * axis data & configuration information 
  391.  *
  392.  */
  393.  
  394. typedef UInt32                             ISpAxisData;
  395.  
  396. #define    kISpAxisMinimum  0x00000000U
  397. #define    kISpAxisMiddle   0x7FFFFFFFU
  398. #define    kISpAxisMaximum  0xFFFFFFFFU
  399.  
  400.  
  401. struct ISpAxisConfigurationInfo {
  402.     Boolean                         symetricAxis;                /* axis is symetric, i.e. a joystick is symetric and a gas pedal is not */
  403. };
  404. typedef struct ISpAxisConfigurationInfo    ISpAxisConfigurationInfo;
  405.  
  406. typedef Fixed                             ISpDeltaData;
  407.  
  408. struct ISpDeltaConfigurationInfo {
  409.     UInt32                             reserved1;
  410.     UInt32                             reserved2;
  411. };
  412. typedef struct ISpDeltaConfigurationInfo ISpDeltaConfigurationInfo;
  413.  
  414. struct ISpMovementData {
  415.     ISpAxisData                     xAxis;
  416.     ISpAxisData                     yAxis;
  417.     ISpDPadData                     direction;                    /* ISpDPadData version of the movement */
  418. };
  419. typedef struct ISpMovementData            ISpMovementData;
  420.  
  421. struct ISpMovementConfigurationInfo {
  422.     UInt32                             reserved1;
  423.     UInt32                             reserved2;
  424. };
  425. typedef struct ISpMovementConfigurationInfo ISpMovementConfigurationInfo;
  426.  
  427. enum {
  428.     kISpVirtualElementFlag_UseTempMem = 1
  429. };
  430.  
  431.  
  432. enum {
  433.     kISpElementListFlag_UseTempMem = 1
  434. };
  435.  
  436.  
  437. enum {
  438.     kISpFirstIconSuite            = 30000,
  439.     kISpLastIconSuite            = 30100,
  440.     kISpNoneIconSuite            = 30000
  441. };
  442.  
  443. /* ********************* user level functions ********************* */
  444.  
  445.  
  446. /*
  447.  *
  448.  * startup / shutdown
  449.  *
  450.  */
  451. EXTERN_API_C( OSStatus )
  452. ISpStartup                        (void);
  453.  
  454. /* 1.1 or later*/
  455. EXTERN_API_C( OSStatus )
  456. ISpShutdown                        (void);
  457.  
  458. /* 1.1 or later*/
  459. /*
  460.  *
  461.  * polling
  462.  *
  463.  */
  464. EXTERN_API_C( OSStatus )
  465. ISpTickle                        (void);
  466.  
  467. /* 1.1 or later*/
  468. /********** user interface functions **********/
  469.  
  470. EXTERN_API_C( NumVersion )
  471. ISpGetVersion                    (void);
  472.  
  473. /*
  474.  *
  475.  * ISpElement_NewVirtual(ISpElementReference *outElement);
  476.  *
  477.  */
  478. EXTERN_API_C( OSStatus )
  479. ISpElement_NewVirtual            (UInt32                 dataSize,
  480.                                  ISpElementReference *    outElement,
  481.                                  UInt32                 flags);
  482.  
  483. /*
  484.  *
  485.  * ISpElement_NewVirtualFromNeeds(UInt32 count, ISpNeeds *needs, ISpElementReference *outElements);
  486.  *
  487.  */
  488. EXTERN_API_C( OSStatus )
  489. ISpElement_NewVirtualFromNeeds    (UInt32                 count,
  490.                                  ISpNeed *                needs,
  491.                                  ISpElementReference *    outElements,
  492.                                  UInt32                 flags);
  493.  
  494. /*
  495.  *
  496.  * ISpElement_DisposeVirtual(inElement);
  497.  *
  498.  */
  499. EXTERN_API_C( OSStatus )
  500. ISpElement_DisposeVirtual        (UInt32                 count,
  501.                                  ISpElementReference *    inElements);
  502.  
  503. /*
  504.  * ISpInit
  505.  *
  506.  */
  507. EXTERN_API_C( OSStatus )
  508. ISpInit                            (UInt32                 count,
  509.                                  ISpNeed *                needs,
  510.                                  ISpElementReference *    inReferences,
  511.                                  OSType                 appCreatorCode,
  512.                                  OSType                 subCreatorCode,
  513.                                  UInt32                 flags,
  514.                                  short                     setListResourceId,
  515.                                  UInt32                 reserved);
  516.  
  517.  
  518. /*
  519.  * ISpConfigure
  520.  *
  521.  */
  522. typedef CALLBACK_API_C( Boolean , ISpEventProcPtr )(EventRecord *inEvent);
  523. EXTERN_API_C( OSStatus )
  524. ISpConfigure                    (ISpEventProcPtr         inEventProcPtr);
  525.  
  526. /*
  527.  *
  528.  * ISpStop
  529.  *
  530.  */
  531. EXTERN_API_C( OSStatus )
  532. ISpStop                            (void);
  533.  
  534. /*
  535.  *
  536.  * ISpSuspend, ISpResume
  537.  *
  538.  * ISpSuspend turns all devices off and allocates memory so that the state may be later resumed.
  539.  * ISpResume resumes to the previous state of the system after a suspend call.
  540.  * 
  541.  * Return Codes
  542.  * memFullErr
  543.  *
  544.  */
  545. EXTERN_API_C( OSStatus )
  546. ISpSuspend                        (void);
  547.  
  548. EXTERN_API_C( OSStatus )
  549. ISpResume                        (void);
  550.  
  551. /*
  552.  * ISpDevices_Extract, ISpDevices_ExtractByClass, ISpDevices_ExtractByIdentifier
  553.  *
  554.  * These will extract as many device references from the system wide list as will fit in your buffer.  
  555.  *
  556.  * inBufferCount - the size of your buffer (in units of sizeof(ISpDeviceReference)) this may be zero
  557.  * buffer - a pointer to your buffer
  558.  * outCount - contains the number of devices in the system
  559.  *
  560.  * ISpDevices_ExtractByClass extracts and counts devices of the specified ISpDeviceClass
  561.  * ISpDevices_ExtractByIdentifier extracts and counts devices of the specified ISpDeviceIdentifier
  562.  *
  563.  * Return Codes
  564.  * paramErr
  565.  *
  566.  */
  567. EXTERN_API_C( OSStatus )
  568. ISpDevices_Extract                (UInt32                 inBufferCount,
  569.                                  UInt32 *                outCount,
  570.                                  ISpDeviceReference *    buffer);
  571.  
  572. EXTERN_API_C( OSStatus )
  573. ISpDevices_ExtractByClass        (ISpDeviceClass         inClass,
  574.                                  UInt32                 inBufferCount,
  575.                                  UInt32 *                outCount,
  576.                                  ISpDeviceReference *    buffer);
  577.  
  578. EXTERN_API_C( OSStatus )
  579. ISpDevices_ExtractByIdentifier    (ISpDeviceIdentifier     inIdentifier,
  580.                                  UInt32                 inBufferCount,
  581.                                  UInt32 *                outCount,
  582.                                  ISpDeviceReference *    buffer);
  583.  
  584.  
  585. /*
  586.  * ISpDevices_ActivateClass, ISpDevices_DeactivateClass, ISpDevices_Activate, ISpDevices_Deactivate, ISpDevice_IsActive
  587.  *
  588.  * ISpDevices_Activate, ISpDevices_Deactivate
  589.  *
  590.  * This will activate/deactivate a block of devices.
  591.  * inDeviceCount - the number of devices to activate / deactivate
  592.  * inDevicesToActivate/inDevicesToDeactivate - a pointer to a block of memory contains the devices references
  593.  *
  594.  * ISpDevices_ActivateClass, ISpDevices_DeactivateClass
  595.  * inClass - the class of devices to activate or deactivate
  596.  *
  597.  * ISpDevice_IsActive
  598.  * inDevice - the device reference that you wish to 
  599.  * outIsActive - a boolean value that is true when the device is active
  600.  *
  601.  * Return Codes
  602.  * paramErr
  603.  *
  604.  */
  605. EXTERN_API_C( OSStatus )
  606. ISpDevices_ActivateClass        (ISpDeviceClass         inClass);
  607.  
  608. /* 1.1 or later*/
  609. EXTERN_API_C( OSStatus )
  610. ISpDevices_DeactivateClass        (ISpDeviceClass         inClass);
  611.  
  612. /* 1.1 or later*/
  613. EXTERN_API_C( OSStatus )
  614. ISpDevices_Activate                (UInt32                 inDeviceCount,
  615.                                  ISpDeviceReference *    inDevicesToActivate);
  616.  
  617. EXTERN_API_C( OSStatus )
  618. ISpDevices_Deactivate            (UInt32                 inDeviceCount,
  619.                                  ISpDeviceReference *    inDevicesToDeactivate);
  620.  
  621. EXTERN_API_C( OSStatus )
  622. ISpDevice_IsActive                (ISpDeviceReference     inDevice,
  623.                                  Boolean *                outIsActive);
  624.  
  625. /*
  626.  * ISpDevice_GetDefinition
  627.  *
  628.  *
  629.  * inDevice - the device you want to get the definition for
  630.  * inBuflen - the size of the structure (sizeof(ISpDeviceDefinition))
  631.  * outStruct - a pointer to where you want the structure copied
  632.  *
  633.  * Return Codes
  634.  * paramErr
  635.  *
  636.  */
  637. EXTERN_API_C( OSStatus )
  638. ISpDevice_GetDefinition            (ISpDeviceReference     inDevice,
  639.                                  UInt32                 inBuflen,
  640.                                  ISpDeviceDefinition *    outStruct);
  641.  
  642.  
  643. /*
  644.  *
  645.  * ISpDevice_GetElementList
  646.  *
  647.  * inDevice - the device whose element list you wish to get
  648.  * outElementList - a pointer to where you want a reference to that list stored
  649.  *
  650.  * Return Codes
  651.  * paramErr
  652.  *
  653.  */
  654. EXTERN_API_C( OSStatus )
  655. ISpDevice_GetElementList        (ISpDeviceReference     inDevice,
  656.                                  ISpElementListReference * outElementList);
  657.  
  658. /*
  659.  *
  660.  * takes an ISpElementReference and returns the group that it is in or 0 if there is
  661.  * no group
  662.  *
  663.  * Return Codes
  664.  * paramErr
  665.  *
  666.  */
  667. EXTERN_API_C( OSStatus )
  668. ISpElement_GetGroup                (ISpElementReference     inElement,
  669.                                  UInt32 *                outGroup);
  670.  
  671. /*
  672.  *
  673.  * takes an ISpElementReference and returns the device that the element belongs 
  674.  * to.
  675.  *
  676.  * Return Codes
  677.  * paramErr if inElement is 0 or outDevice is nil
  678.  *
  679.  */
  680. EXTERN_API_C( OSStatus )
  681. ISpElement_GetDevice            (ISpElementReference     inElement,
  682.                                  ISpDeviceReference *    outDevice);
  683.  
  684. /*
  685.  *
  686.  * takes an ISpElementReference and gives the ISpElementInfo for that Element.  This is the
  687.  * the set of standard information.  You get ISpElementKind specific information
  688.  * through ISpElement_GetConfigurationInfo.
  689.  *
  690.  * Return Codes
  691.  * paramErr if inElement is 0 or outInfo is nil
  692.  *
  693.  */
  694. EXTERN_API_C( OSStatus )
  695. ISpElement_GetInfo                (ISpElementReference     inElement,
  696.                                  ISpElementInfoPtr         outInfo);
  697.  
  698. /*
  699.  *
  700.  *         
  701.  *
  702.  * takes an ISpElementReference and gives the ISpElementKind specific configuration information
  703.  * 
  704.  * if buflen is not long enough to hold the information ISpElement_GetConfigurationInfo will
  705.  * copy buflen bytes of the data into the block of memory pointed to by configInfo and
  706.  * will return something error.
  707.  *
  708.  * Return Codes
  709.  * paramErr if inElement or configInfo is nil
  710.  *
  711.  */
  712. EXTERN_API_C( OSStatus )
  713. ISpElement_GetConfigurationInfo    (ISpElementReference     inElement,
  714.                                  UInt32                 buflen,
  715.                                  void *                    configInfo);
  716.  
  717. /*
  718.  *
  719.  * ISpElement_GetSimpleState
  720.  *
  721.  * Takes an ISpElementReference and returns the current state of that element.  This is a 
  722.  * specialized version of ISpElement_GetComplexState that is only appropriate for elements
  723.  * whose data fits in a signed 32 bit integer.
  724.  *
  725.  *
  726.  *
  727.  * Return Codes
  728.  * paramErr if inElement is 0 or state is nil
  729.  *
  730.  */
  731. EXTERN_API_C( OSStatus )
  732. ISpElement_GetSimpleState        (ISpElementReference     inElement,
  733.                                  UInt32 *                state);
  734.  
  735. /*
  736.  *
  737.  * ISpElement_GetComplexState
  738.  *
  739.  * Takes an ISpElementReference and returns the current state of that element.  
  740.  * Will copy up to buflen bytes of the current state of the device into
  741.  * state.
  742.  *
  743.  *
  744.  * Return Codes
  745.  * paramErr if inElement is 0 or state is nil
  746.  *
  747.  */
  748. EXTERN_API_C( OSStatus )
  749. ISpElement_GetComplexState        (ISpElementReference     inElement,
  750.                                  UInt32                 buflen,
  751.                                  void *                    state);
  752.  
  753.  
  754. /*
  755.  * ISpElement_GetNextEvent
  756.  *
  757.  * It takes in an element  reference and the buffer size of the ISpElementEventPtr
  758.  * it will set wasEvent to true if there was an event and false otherwise.  If there
  759.  * was not enough space to fill in the whole event structure that event will be
  760.  * dequed, as much of the event as will fit in the buffer will by copied and
  761.  * ISpElement_GetNextEvent will return an error.
  762.  *
  763.  * Return Codes
  764.  * paramErr
  765.  *
  766.  */
  767. EXTERN_API_C( OSStatus )
  768. ISpElement_GetNextEvent            (ISpElementReference     inElement,
  769.                                  UInt32                 bufSize,
  770.                                  ISpElementEventPtr     event,
  771.                                  Boolean *                wasEvent);
  772.  
  773. /*
  774.  *
  775.  * ISpElement_Flush
  776.  *
  777.  * It takes an ISpElementReference and flushes all the events on that element.  All it guaruntees is
  778.  * that any events that made it to this layer before the time of the flush call will be flushed and
  779.  * it will not flush any events that make it to this layer after the time when the call has returned.
  780.  * What happens to events that occur during the flush is undefined.
  781.  *
  782.  *
  783.  * Return Codes
  784.  * paramErr
  785.  *
  786.  */
  787. EXTERN_API_C( OSStatus )
  788. ISpElement_Flush                (ISpElementReference     inElement);
  789.  
  790.  
  791.  
  792. /*
  793.  * ISpElementList_New
  794.  *
  795.  * Creates a new element list and returns it in outElementList.  In count specifies 
  796.  * the number of element references in the list pointed to by inElements.  If inCount
  797.  * is non zero the list is created with inCount elements in at as specified by the 
  798.  * inElements parameter.  Otherwise the list is created empty.
  799.  *
  800.  *
  801.  * Return Codes
  802.  * out of memory - If it failed to allocate the list because it was out of memory
  803.                    it will also set outElementList to 0
  804.  * paramErr if outElementList was nil
  805.  *
  806.  *
  807.  * Special Concerns
  808.  *
  809.  * interrupt unsafe
  810.  *
  811.  */
  812. EXTERN_API_C( OSStatus )
  813. ISpElementList_New                (UInt32                 inCount,
  814.                                  ISpElementReference *    inElements,
  815.                                  ISpElementListReference * outElementList,
  816.                                  UInt32                 flags);
  817.  
  818. /*
  819.  * ISpElementList_Dispose
  820.  *
  821.  * Deletes an already existing memory list.  
  822.  *
  823.  *
  824.  * Return Codes
  825.  * paramErr if inElementList was 0
  826.  *
  827.  *
  828.  * Special Concerns
  829.  *
  830.  * interrupt unsafe
  831.  *
  832.  */
  833. EXTERN_API_C( OSStatus )
  834. ISpElementList_Dispose            (ISpElementListReference  inElementList);
  835.  
  836. /*
  837.  * ISpGetGlobalElementList
  838.  *
  839.  * returns the global element list
  840.  *
  841.  * Return Codes
  842.  * paramErr if outElementList is nil
  843.  *
  844.  */
  845. EXTERN_API_C( OSStatus )
  846. ISpGetGlobalElementList            (ISpElementListReference * outElementList);
  847.  
  848. /*
  849.  * ISpElementList_AddElement
  850.  *
  851.  * adds an element to the element list
  852.  *
  853.  * Return Codes
  854.  * paramErr if inElementList is 0 or newElement is 0
  855.  * memory error if the system is unable to allocate enough memory
  856.  *
  857.  * Special Concerns
  858.  * interrupt Unsafe
  859.  * 
  860.  */
  861. EXTERN_API_C( OSStatus )
  862. ISpElementList_AddElements        (ISpElementListReference  inElementList,
  863.                                  UInt32                 refCon,
  864.                                  UInt32                 count,
  865.                                  ISpElementReference *    newElements);
  866.  
  867. /*
  868.  * ISpElementList_RemoveElement
  869.  *
  870.  * removes the specified element from the element list
  871.  *
  872.  * Return Codes
  873.  * paramErr if inElementList is 0 or oldElement is 0
  874.  * memory error if the system is unable to allocate enough memory
  875.  *
  876.  * Special Concerns
  877.  * interrupt Unsafe
  878.  * 
  879.  */
  880. EXTERN_API_C( OSStatus )
  881. ISpElementList_RemoveElements    (ISpElementListReference  inElementList,
  882.                                  UInt32                 count,
  883.                                  ISpElementReference *    oldElement);
  884.  
  885. /*
  886.  * ISpElementList_Extract
  887.  *
  888.  * ISpElementList_Extract will extract as many of the elements from an element list as possible.  You pass
  889.  * in an element list, a pointer to an array of element references and the number of elements in that array.
  890.  * It will return how many items are in the element list in the outCount parameter and copy the minimum of 
  891.  * that number and the size of the array into the buffer.
  892.  *
  893.  * ByKind and ByLabel are the same except that they will only count and copy element references to elements
  894.  * that have the specified kind and label.
  895.  *
  896.  * Return Codes
  897.  * paramErr
  898.  *
  899.  */
  900. EXTERN_API_C( OSStatus )
  901. ISpElementList_Extract            (ISpElementListReference  inElementList,
  902.                                  UInt32                 inBufferCount,
  903.                                  UInt32 *                outCount,
  904.                                  ISpElementReference *    buffer);
  905.  
  906. EXTERN_API_C( OSStatus )
  907. ISpElementList_ExtractByKind    (ISpElementListReference  inElementList,
  908.                                  ISpElementKind         inKind,
  909.                                  UInt32                 inBufferCount,
  910.                                  UInt32 *                outCount,
  911.                                  ISpElementReference *    buffer);
  912.  
  913. EXTERN_API_C( OSStatus )
  914. ISpElementList_ExtractByLabel    (ISpElementListReference  inElementList,
  915.                                  ISpElementLabel         inLabel,
  916.                                  UInt32                 inBufferCount,
  917.                                  UInt32 *                outCount,
  918.                                  ISpElementReference *    buffer);
  919.  
  920. /*
  921.  * ISpElementList_GetNextEvent
  922.  *
  923.  * It takes in an element list reference and the buffer size of the ISpElementEventPtr
  924.  * it will set wasEvent to true if there was an event and false otherwise.  If there
  925.  * was not enough space to fill in the whole event structure that event will be
  926.  * dequed, as much of the event as will fit in the buffer will by copied and
  927.  * ISpElementList_GetNextEvent will return an error.
  928.  *
  929.  * Return Codes
  930.  * paramErr
  931.  *
  932.  */
  933. EXTERN_API_C( OSStatus )
  934. ISpElementList_GetNextEvent        (ISpElementListReference  inElementList,
  935.                                  UInt32                 bufSize,
  936.                                  ISpElementEventPtr     event,
  937.                                  Boolean *                wasEvent);
  938.  
  939. /*
  940.  *
  941.  * ISpElementList_Flush
  942.  *
  943.  * It takes an ISpElementListReference and flushes all the events on that list.  All it guaruntees is
  944.  * that any events that made it to this layer before the time of the flush call will be flushed and
  945.  * it will not flush any events that make it to this layer after the time when the call has returned.
  946.  * What happens to events that occur during the flush is undefined.
  947.  *
  948.  *
  949.  * Return Codes
  950.  * paramErr
  951.  *
  952.  */
  953. EXTERN_API_C( OSStatus )
  954. ISpElementList_Flush            (ISpElementListReference  inElementList);
  955.  
  956. /*
  957.  *
  958.  * ISpTimeToMicroseconds
  959.  *
  960.  *
  961.  * This function takes time from an input sprocket event and converts it
  962.  * into microseconds. (Version 1.2 or later of InputSprocket.)
  963.  *
  964.  *
  965.  * Return Codes
  966.  * paramErr
  967.  *
  968.  */
  969. EXTERN_API_C( OSStatus )
  970. ISpTimeToMicroseconds            (const AbsoluteTime *    inTime,
  971.                                  UnsignedWide *            outMicroseconds);
  972.  
  973. #endif  /* TARGET_RT_MAC_CFM */
  974.  
  975.  
  976.  
  977. #if PRAGMA_STRUCT_ALIGN
  978.     #pragma options align=reset
  979. #elif PRAGMA_STRUCT_PACKPUSH
  980.     #pragma pack(pop)
  981. #elif PRAGMA_STRUCT_PACK
  982.     #pragma pack()
  983. #endif
  984.  
  985. #ifdef PRAGMA_IMPORT_OFF
  986. #pragma import off
  987. #elif PRAGMA_IMPORT
  988. #pragma import reset
  989. #endif
  990.  
  991. #ifdef __cplusplus
  992. }
  993. #endif
  994.  
  995. #endif /* __INPUTSPROCKET__ */
  996.  
  997.